package com.sinog.biz.service.business.impl;

import com.sinog.biz.mapper.havexml.SystemCodeMapper;
import com.sinog.biz.service.business.SearchCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @desc 行政区划实现类
 * @author -
 * @date -
 */
@Service
@Slf4j
public class SearchCodeServiceImpl implements SearchCodeService {

    @Resource
    private SystemCodeMapper systemCodeMapper;

    /**
     * 根据codeid与codetype，查询 tbsys_code 表
     * @param codeType codeType
     * @param codeId codeId
     * @return List<Map < String,String>>
     */
    @Override
    public List<Map<String,String>> getCodeByCodeId(String codeType,String codeId) {
        return systemCodeMapper.getCodeByCodeId(codeType,codeId);
    }

    /**
     * 衔接 - 信息录入 - 查询职业技能详情
     * 根据职业技能分类的id,查询下面的职业技能，如果结果为空，职业技能取职业技能分类的结果
     * @param codeType codeType
     * @param pcodeId pcodeId
     * @return List<Map < String,String>>
     */
    @Override
    public List<Map<String,String>> echozyjnValue(String codeType,String pcodeId) {
        List<Map<String,String>> result;
        result = systemCodeMapper.getCodeByPcodeId(codeType,pcodeId);
        if(result.isEmpty()) {
            result = systemCodeMapper.getCodeByCodeId(codeType,pcodeId);
        }
        return result;
    }

    /**
     * 根据罪犯编码获取罪犯名称
     * @param codeIds codeIds
     * @return List<String>
     */
    @Override
    public List<String> getCodeNameByCodeIds(List<String> codeIds) {
        return systemCodeMapper.getCodeNameByCodeIds(codeIds);
    }
}